import request from '@/utils/request'

/**
 * @description 获取所有角色列表
 * @param {*} params
 * @returns
 */
export const getRoleApi = (params) => request({
  url: '/sys/role',
  params
})

/**
 * @description 根据id查询企业
 * @param {*} id
 * @returns
 */
export const getCompanyInfoApi = (id) => request({
  url: `/company/${id}`
})

/**
 * @description 添加角色
 * @param {*} data
 * @returns
 */
export const addRoleApi = (data) => request({
  url: '/sys/role',
  method: 'POST',
  data
})

/**
 * @description 根据ID获取角色详情
 * @param {*} id
 * @returns
 */
export const getRoleInfoApi = (id) => request({
  url: `/sys/role/${id}`
})

/**
 * @description 根据ID更新角色
 * @param {*} data
 * @returns
 */
export const editRoleInfoApi = (data) => request({
  url: `/sys/role/${data.id}`,
  method: 'PUT',
  data
})

/**
 * @description 根据ID删除角色
 * @param {*} id
 * @returns
 */
export const delRoleInfoApi = (id) => request({
  url: `/sys/role/${id}`,
  method: 'DELETE'
})
